<extend name="Base/common"/>
<block name="style">
    <link href="__CSS__/login_common.css" rel="stylesheet">
    <link href="__CSS__/reset.css" rel="stylesheet" />
    <link href="__CSS__/font-awesome.min.css" rel="stylesheet" />
</block>
<block name="body">
    <div class="wrap login_wrap">
        <div class="content">
            <div class="login_box" style="margin-top:-155px;">
                <div class="login_form">
                    <div class="login_title">
                        代理登录
                    </div>
                    <form action="#" method="post">

                        <div class="form_text_ipt">
                            <input name="username" type="text" placeholder="用户名">
                        </div>
                        <div class="ececk_warning"><span>用户名不能为空</span></div>
                        <div class="form_text_ipt">
                            <input name="password" type="password" placeholder="密码">
                        </div>
                        <div class="ececk_warning"><span>密码不能为空</span></div>

                        <div class="form_btn">
                            <button type="button" id="login_btn" onclick="javascript:;">登录</button>
                        </div>
                        <div class="form_reg_btn">
                          <a href="{:U('Index/register')}">注册</a>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript" src="__JS__/common.js" ></script>
    <script type="text/javascript">
        $(function(){
            $("#login_btn").click(function(){
                var submit = false;
                //表单验证
                $('.form_text_ipt input').each(function(){
                    if($(this).val()==""){
                        layer.msg("请填写用户名和密码");
                        submit = false;
                        return false;
                    }else{
                        submit = true;
                    }
                });
                if(submit){
                    $.post('{:U("Index/login")}', $("form").serialize(), function(data){
                        if(data.status){
                            layer.msg(data.info)
                            setTimeout(function () {
                                location.href = data.url
                            },1000);
                        }else{
                            layer.msg(data.info);
                        }
                    });

                }

            })


        });
    </script>

</block>


